<?php
/**
 * Created by PhpStorm.
 * User: Vova
 * Date: 8/30/14
 * Time: 2:17 PM
 */
$sql_login_host = "localhost"; # MySQL Host
$sql_login_user = "root"; # MySql UserName
$sql_login_pass = ""; # MySql Password
$sql_login_db = "door_market"; # MySql Database

$con = mysqli_connect($sql_login_host, $sql_login_user, $sql_login_pass, $sql_login_db) or die("Some error occurred during connection " . mysqli_error($con));

// Write query

$sql = "SELECT * FROM item";

// Execute the query.

$query = mysqli_query($con, $sql);

$user_name = "Vova";
$user_pass = "1";
$sql = "INSERT INTO SYSTEM_USER(user_name,user_pass) values('" . $user_name . "','" . md5($user_pass) . "')";
$query = mysqli_query($con, $sql);

if (mysqli_errno($con)) {
    echo "Error:" . mysqli_error($con);
} else {
    echo "No error";
}

exit();
while ($result = mysqli_fetch_array($query)) {
    echo $result["item_name"] . "<br>";
}

// Close the connection
mysqli_close($con);

?>